package com.zimin.common.utils;

import cn.hutool.core.util.StrUtil;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author zimin
 * @since 2021/10/14 3:44 下午
 */
public class StringUtils extends org.springframework.util.StringUtils {

    /**
     * <p>校验字符串不为空</p>
     *
     * @param params 校验的字符串
     * @return boolean
     * @author zimin
     * @since 2021-10-15 15:46:31
     */
    public static boolean isNotEmpty(String  params){
        return !isEmpty(params);
    }

    /**
     * <p>校验对象是否为空字符串</p>
     *
     * @param params 校验的字符串
     * @return boolean
     * @author zimin
     * @since 2021-10-26 11:37:22
     */
    public static boolean isBlank(String params){
        return StringUtils.isEmpty(params);
    }

    /**
     * <p>校验对象是否不为空字符串</p>
     *
     * @param params 校验字符串
     * @return boolean
     * @author zimin
     * @since 2021-10-26 11:38:26
     */
    public static boolean isNotBlank(String params){
        return !isBlank(params);
    }


    /**
     * 切分字符串 [a,b,c]
     *
     * @param str 字符串
     */
    public static List<String> split(CharSequence str) {
        return StrUtil.split(str, ',').stream().map(s -> s.trim()).collect(Collectors.toList());
    }

    public static boolean isAllNotBlank(CharSequence... str){
        return StrUtil.isAllNotBlank(str);
    }

}
